<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="/authUtil"  prefix="authUtil"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>主页面</title>
</head>
<body>
	<div>欢迎你,${user.name}</div>
	<div id="content">
	
	</div>
	<div id="addAuth">
		
		<h2>附加权限${user.auth }</h2>
		<c:if test="${authUtil:isAuth(user.auth,0) }">
			<button>增加或修改管理员</button><br>
		</c:if>
		<c:if test="${authUtil:isAuth(user.auth,1) }">
			<button id="auth1">增加或修改或删除房间类型</button><br>
		</c:if>
		<c:if test="${authUtil:isAuth(user.auth,2) }">
			<button id="auth2">增加修改或删除房间</button><br>
		</c:if>
		<c:if test="${authUtil:isAuth(user.auth,3) }">
			<button>记录入住信息</button><br>
		</c:if>
		<c:if test="${authUtil:isAuth(user.auth,4) }">
			<button>换房信息录入</button><br>
		</c:if>
		<c:if test="${authUtil:isAuth(user.auth,5) }">
			<button>续住信息录入</button><br>
		</c:if>
		<c:if test="${authUtil:isAuth(user.auth,6) }">
			<button>查看财务流水</button>
		</c:if>
	</div>
</body>
<script type="text/javascript" src="/hotel/js/jquery.min.js"></script>
<script type="text/javascript" src="/hotel/js/cookiesUtil.js"></script>
<script type="text/javascript">
	$("#auth1").click(function(){
		setCookie("fun",1);
		$("#content").load( "/hotel/roomType/roomTypeList")
	})
	$("#auth2").click(function(){
		setCookie("fun",2);
		$("#content").load( "/hotel/room/roomList")
	})
	var fun=getCookie('fun');
	//alert(fun)
	<c:if test="${user.roleCode==0}">
		if(fun==null||fun==0){
			$("#content").load( "/hotel/admin/addAdmin")
			fun=0;
			setCookie("fun",fun);
		}
	</c:if>
	<c:if test="${user.roleCode==1}">
		if(fun==null||fun==1){
			$("#content").load( "/hotel/roomType/roomTypeList")
			fun=1;
			setCookie("fun",fun);
		}
		if(fun==2)
			$("#content").load( "/hotel/room/roomList")
	</c:if>
	<c:if test="${user.roleCode==2}">
		//if(fun==null||fun==1){
		$("#content").load( "/hotel/checkIn/mainMenu")
		fun=1;
		setCookie("fun",fun);
		//}
		//if(fun==2)
		//	$("#content").load( "/hotel/room/roomList")
	</c:if>
	<c:if test="${user.roleCode==3}">
		$("#content").load( "/hotel/finance/mainMenu")
	</c:if>
</script>
</html>